﻿@using BlogEngine.Core
@{
    var name = Security.CurrentUser.Identity.Name;
    var src = Utils.ApplicationRelativeWebRoot + "Content/images/blog/noavatar.jpg";
    var displayName = "Anonymous";

    var profile = AuthorProfile.GetProfile(name);
    if (profile != null)
    {
        if (!string.IsNullOrEmpty(profile.PhotoUrl))
        {
            src = Utils.ApplicationRelativeWebRoot + "image.axd?picture=/avatars/" + profile.PhotoUrl;
        }
        displayName = profile.DisplayName;
    }
}
<div class="nav-user">
    <div class="nav-user-info">
        <div class="nav-user-img"><img src="@src" /></div>
        <div class="nav-user-name text-ellipsis">@displayName</div>
    </div>
    <ul class="nav-user-actions clearfix">
        <li title="@Resources.labels.logoff"><a href="{{SiteVars.RelativeWebRoot}}Account/login.aspx?logoff"><i class="fa fa-power-off"></i></a></li>
        <li title="@Resources.labels.changePassword"><a href="{{SiteVars.RelativeWebRoot}}Account/change-password.aspx" target="_blank"><i class="fa fa-key"></i></a></li>
        <li title="@Resources.labels.profile"><a href="{{SiteVars.RelativeWebRoot}}admin/#/security/profile"><i class="fa fa-user"></i></a></li>
        <li title="@Resources.labels.viewMyBlog"><a href="{{SiteVars.RelativeWebRoot}}" target="_blank"><i class="fa fa-globe"></i></a></li>
    </ul>
</div>
<div class="nav-sidebar">
    <ul data-ng-controller="NavController">
        @if (Security.IsAuthorizedTo(Rights.ViewDashboard))
        {
            <li id="mu-dashboard" class="active"><a href="{{SiteVars.RelativeWebRoot}}admin/#/dashboard"><i class="fa fa-th-large"></i> @Resources.labels.dashboard</a></li>
        }
        <li id="mu-content">
            <a href="{{SiteVars.RelativeWebRoot}}admin/#/content/posts"><i class="fa fa-align-justify"></i> @Resources.labels.content</a>
            <ul class="sub-nav-sidebar">
                <li id="mu-posts" data-ng-class="{ active: isActive('/content/posts')}"><a href="{{SiteVars.RelativeWebRoot}}admin/#/content/posts">@Resources.labels.posts</a></li>
                @if (BlogSettings.Instance.CommentProvider == BlogSettings.CommentsBy.BlogEngine)
            {
                    <li id="mu-comments" data-ng-class="{ active: isActive('/content/comments')}"><a href="{{SiteVars.RelativeWebRoot}}admin/#/content/comments">@Resources.labels.comments</a></li>
                }
                <li id="mu-pages" data-ng-class="{ active: isActive('/content/pages')}"><a href="{{SiteVars.RelativeWebRoot}}admin/#/content/pages">@Resources.labels.pages</a></li>
                <li data-ng-class="{ active: isActive('/content/categories')}"><a href="{{SiteVars.RelativeWebRoot}}admin/#/content/categories">@Resources.labels.categories</a></li>
                <li data-ng-class="{ active: isActive('/content/tags')}"><a href="{{SiteVars.RelativeWebRoot}}admin/#/content/tags">@Resources.labels.tags</a></li>
                @if (Blog.CurrentInstance.IsPrimary && Security.IsAdministrator && BlogConfig.UsageScenario == "multiblogs")
            {
                    <li data-ng-class="{ active: isActive('/content/blogs')}"><a href="{{SiteVars.RelativeWebRoot}}admin/#/content/blogs">@Resources.labels.blogs</a></li>
                }
            </ul>
        </li>
   
        @if (BlogConfig.UsageScenario == "multiusers")
        {
            <li id="mu-users">
                <a href="{{SiteVars.RelativeWebRoot}}admin/#/security/profile"><i class="fa fa-user"></i> @Resources.labels.users</a>
                <ul class="sub-nav-sidebar">
                    <li data-ng-class="{ active: isActive('/security/profile')}"><a class="ng-binding" href="{{SiteVars.RelativeWebRoot}}admin/#/security/profile">@Resources.labels.profile</a></li>
                    @if (Security.IsAuthorizedTo(Rights.ViewRoles))
                    {
                        <li data-ng-class="{ active: isActive('/security/roles')}"><a class="ng-binding" href="{{SiteVars.RelativeWebRoot}}admin/#/security/roles">@Resources.labels.roles</a></li>
                    }
                    @if (Security.IsAuthorizedTo(Rights.EditOtherUsers))
                    {
                        <li data-ng-class="{ active: isActive('/security/users')}"><a class="ng-binding" href="{{SiteVars.RelativeWebRoot}}admin/#/security/users">@Resources.labels.users</a></li>
                    }
                </ul>
            </li>
        }
    </ul>
</div>
<div class="logo-sidebar">
    <a href="http://dotnetblogengine.net/" target="_blank" title="BlogEngine.NET - Version @BlogSettings.Instance.Version()"><img src="~/admin/themes/standard/img/logo-sidebar.png" alt="BlogEngine.NET" /></a>
</div>